import request from '@/utils/request'

// 查询库存盘点列表
export function listPdmMstr(query) {
  return request({
    url: '/repertory/PdmMstr/list',
    method: 'get',
    params: query,
  })
}

export function listPddDet(pdmDjbh) {
  return request({
    url: '/repertory/PdmMstr/listPdd/' + pdmDjbh,
    method: 'get',
  })
}

// 查询库存盘点头表详细
export function getPdmMstr(pdmId) {
  return request({
    url: '/repertory/PdmMstr/' + pdmId,
    method: 'get',
  })
}

// 查询库存盘点单详细表数据
export function getPddById(pdmId) {
  return request({
    url: '/repertory/PdmMstr/getPddById/' + pdmId,
    method: 'get',
  })
}

// 新增库存盘点
export function addPdmMstr(data) {
  return request({
    url: '/repertory/PdmMstr',
    method: 'post',
    data: data,
  })
}

// 修改库存盘点
export function updatePdmMstr(data) {
  return request({
    url: '/repertory/PdmMstr',
    method: 'put',
    data: data,
  })
}

// 删除库存盘点
export function delPdmMstr(pdmId) {
  return request({
    url: '/repertory/PdmMstr/' + pdmId,
    method: 'delete',
  })
}

// 提交
export function submitPdmMstr(pdmId) {
  return request({
    url: '/repertory/PdmMstr/submitPdmMstr/' + pdmId,
    method: 'post',
  })
}

// 添加-查询
export function searchChildData(query) {
  return request({
    url: '/repertory/PdmMstr/searchChildData',
    method: 'get',
    params: query,
  })
}

// 添加-保存
export function savePdd(data) {
  return request({
    url: '/repertory/PdmMstr/savePdd',
    method: 'post',
    data: data,
  })
}

// 实盘-保存数据
export function firmSubmit(data) {
  return request({
    url: '/repertory/PdmMstr/firmSubmit',
    method: 'post',
    data: data,
  })
}

// 实盘-删除
export function delPddDet(pddId) {
  return request({
    url: '/repertory/PdmMstr/delPddDet/' + pddId,
    method: 'delete',
  })
}

//实盘数据导入
export function importPdd(data) {
  return request({
    url: '/repertory/PdmMstr/importPdd',
    method: 'post',
    data: data,
  })
}

// 导出工程文件
export function exportFirm(query) {
  return request({
    url: '/repertory/PdmMstr/exportFirm',
    method: 'get',
    params: query,
  })
}

// 确认
export function confirmPdm(pdmId) {
  return request({
    url: '/repertory/PdmMstr/confirmPdm/' + pdmId,
    method: 'post',
  })
}

// 实盘确认-撤回
export function backConfirm(pdmId, backReson) {
  return request({
    url: '/repertory/PdmMstr/backConfirm/' + pdmId + '/' + backReson,
    method: 'put',
  })
}
// 高层批准 - 批准
export function approvePdmMstr(pdmId) {
  return request({
    url: '/repertory/PdmMstr/approvePdmMstr/' + pdmId,
    method: 'put',
  })
}

//仓库过账-过账
export function postPdmMstr(pdmId) {
  return request({
    url: '/repertory/PdmMstr/postPdmMstr/' + pdmId,
    method: 'put',
  })
}

// 报表-查询
export function pdmReport(query) {
  return request({
    url: '/repertory/PdmMstr/pdmReport',
    method: 'get',
    params: query,
  })
}
